package com.app.business.show;

import com.alibaba.fastjson.JSON;
import com.app.business.model.*;
import com.app.business.service.*;
import com.app.system.jpa.PageBean;
import com.app.system.permission.service.DataDictService;
import com.app.system.utils.CollectionUtils;
import com.app.system.utils.ParamUtils;
import com.app.system.utils.dataType.DateUtils;
import com.app.system.utils.dataType.IntegerUtils;
import com.app.system.utils.dataType.StringUtils;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 大屏公示（没有权限限制）
 * Created by ddz on 2023/12/20.
 */
@Controller
@RequestMapping("/showForCy2024/*")
@SuppressWarnings("all")
public class ShowForCy2024Controller {
    @Autowired
    private ContractService contractService;
    @Autowired
    private ZsProjectService zsProjectService;
    @Autowired
    private AzProjectService azProjectService;
    @Autowired
    private DataDictService dataDictService;
    @Autowired
    private HouseService houseService;
    @Autowired
    private ShowHjService showHjService;
    @Autowired
    private CarLotService carLotService;
    @Autowired
    private StorageRoomService storageRoomService;

    /**
     * 潮韵华庭
     */
    @RequestMapping("houseShowCy1")
    public void houseShowCy1(HttpServletRequest request, ModelMap modelMap) {
        Map<String, String> colorMap = this.dataDictService.getMapByParentNameForValue_Color("公示颜色");
        modelMap.addAttribute("colorMap", colorMap);
    }
    /**
     * 潮韵华庭
     */
    @RequestMapping("houseShowCy2")
    public void houseShowCy2(HttpServletRequest request, ModelMap modelMap) {
        Map<String, String> colorMap = this.dataDictService.getMapByParentNameForValue_Color("公示颜色");
        modelMap.addAttribute("colorMap", colorMap);
    }

    /**
     * 楼盘图
     *
     * @param request
     */
    @RequestMapping("housePic")
    public void housePic(HttpServletRequest request, ModelMap modelMap) {
        String zsProjectIdStr = ParamUtils.getString(request, "zsProjectIdStr", "");
        Integer azProjectId = ParamUtils.getInt(request, "azProjectId", 0);
        String buildNum = ParamUtils.getString(request, "buildNum", "");
        String floor = ParamUtils.getString(request, "floor", "");
        Integer minFloor = ParamUtils.getInt(request, "minFloor", 1);

        //通过征收项目、安置项目、楼号得到所分配的houseList
        List<House> houseList = houseService.houseList(zsProjectIdStr, azProjectId, buildNum, floor);
        //得到层号和当前楼层的List<House>对应的map
        Map<String, Map<String, House>> floorAndHouseNumForHouseMap = houseService.getFloorAndHouseNumMap(houseList);
        //获取当前安置项目最高层
        Map<String, Integer> maxFloorMap = houseService.getMaxFloorMap(zsProjectIdStr, azProjectId, buildNum, floor);
        Integer maxFloor = maxFloorMap.get("maxFloor");
        Integer maxHouseNum = maxFloorMap.get("maxHouseNum");
        //房源状态
        Map<String, String> colorMap = this.dataDictService.getMapByParentNameForValue_Color("公示颜色");
        //房屋类型
        Map<String, String> houseHoldMap = this.dataDictService.getMapByParentNameForValue_Name("房屋户型");

        modelMap.addAttribute("buildNum", buildNum);
        modelMap.addAttribute("floorAndHouseNumForHouseMap", floorAndHouseNumForHouseMap);
        modelMap.addAttribute("maxFloor", maxFloor);
        modelMap.addAttribute("minFloor", minFloor);
        modelMap.addAttribute("rowNum", Math.round(maxHouseNum / 10) == 0 ? 1 : Math.round(maxHouseNum / 10));
        modelMap.addAttribute("maxHouseNum", maxHouseNum);
        modelMap.addAttribute("colorMap", colorMap);
        modelMap.addAttribute("houseHoldMap", houseHoldMap);
    }

    /**
     * 楼盘图
     *
     * @param request
     */
    @RequestMapping("housePicNoChooseed")
    public void housePicNoChooseed(HttpServletRequest request, ModelMap modelMap) {
        String zsProjectIdStr = ParamUtils.getString(request, "zsProjectIdStr", "");
        Integer azProjectId = ParamUtils.getInt(request, "azProjectId", 0);
        String buildNum = ParamUtils.getString(request, "buildNum", "");
        String floor = ParamUtils.getString(request, "floor", "");
        Integer minFloor = ParamUtils.getInt(request, "minFloor", 1);

        //通过征收项目、安置项目、楼号得到所分配的houseList
        List<House> houseList = houseService.houseList(zsProjectIdStr, azProjectId, buildNum, floor,1);
        //得到层号和当前楼层的List<House>对应的map
        Map<String, Map<String, House>> floorAndHouseNumForHouseMap = houseService.getFloorAndHouseNumMap(houseList);
        //获取当前安置项目最高层
        Map<String, Integer> maxFloorMap = houseService.getMaxFloorMap(zsProjectIdStr, azProjectId, buildNum, floor);
        Integer maxFloor = maxFloorMap.get("maxFloor");
        Integer maxHouseNum = maxFloorMap.get("maxHouseNum");
        //房源状态
        Map<String, String> colorMap = this.dataDictService.getMapByParentNameForValue_Color("公示颜色");
        //房屋类型
        Map<String, String> houseHoldMap = this.dataDictService.getMapByParentNameForValue_Name("房屋户型");

        modelMap.addAttribute("buildNum", buildNum);
        modelMap.addAttribute("floorAndHouseNumForHouseMap", floorAndHouseNumForHouseMap);
        modelMap.addAttribute("maxFloor", maxFloor);
        modelMap.addAttribute("minFloor", minFloor);
        modelMap.addAttribute("rowNum", Math.round(maxHouseNum / 10) == 0 ? 1 : Math.round(maxHouseNum / 10));
        modelMap.addAttribute("maxHouseNum", maxHouseNum);
        modelMap.addAttribute("colorMap", colorMap);
        modelMap.addAttribute("houseHoldMap", houseHoldMap);
    }

    /**
     * 楼盘图
     *
     * @param request
     */
    @RequestMapping("housePicAllFor10")
    public void housePicAllFor10(HttpServletRequest request, ModelMap modelMap) {
        String zsProjectIdStr = ParamUtils.getString(request, "zsProjectIdStr", "");
        Integer azProjectId = ParamUtils.getInt(request, "azProjectId", 0);
        String houseStyle = ParamUtils.getString(request, "houseStyle", "");
        String houseHold = ParamUtils.getString(request, "houseHold", "");
        String houseArea = ParamUtils.getString(request, "houseArea", "");
        String buildNumStr = ParamUtils.getString(request, "buildNumStr", "");

        //通过征收项目、安置项目、楼号得到所分配的houseList
        Map<String, List> houseMap = showHjService.houseMapFoJy(zsProjectIdStr, azProjectId, houseHold, houseStyle, null);
        Set set = houseMap.keySet();
        //房源状态
        Map<String, String> colorMap = this.dataDictService.getMapByParentNameForValue_Color("房源状态");
        //房屋类型
        Map<String, String> houseHoldMap = this.dataDictService.getMapByParentNameForValue_Name("房屋户型");
        modelMap.addAttribute("colorMap", colorMap);
        modelMap.addAttribute("houseHoldMap", houseHoldMap);
        List<String> buildNumList = showHjService.buildNumListFoJy(zsProjectIdStr, azProjectId, houseHold, houseStyle, null, buildNumStr);
        modelMap.addAttribute("buildNumList", buildNumList);
        modelMap.addAttribute("houseMap", houseMap);
        modelMap.addAttribute("strUtils", new StringUtils());
    }


    /**
     * 选房家庭公示
     *
     * @param request
     * @param modelMap
     */
    @RequestMapping("contractShowForCy")
    public void contractShowForCy(HttpServletRequest request, ModelMap modelMap) {

    }

    /**
     * 选房家庭明细
     *
     * @param request
     * @return
     */
    @RequestMapping("getChooseHouseInfo")
    @ResponseBody
    public Map getChooseHouseInfo(HttpServletRequest request) {
        String zsProjectIdStr = ParamUtils.getString(request, "zsProjectIdStr", "181,182,183,184,185,186");
        String azProjectIdStr = ParamUtils.getString(request, "azProjectIdStr", "36");
        Integer pageSize = ParamUtils.getInt(request, "pageSize", 20);
        Integer pageNo = ParamUtils.getInt(request, "pageNo", 1);
        PageBean<Contract> pageBean = new PageBean<Contract>();
        pageBean = this.contractService.getChoosedHouseContractPageBean(zsProjectIdStr, azProjectIdStr, pageSize, pageNo);
        List<Map> dataLists = Lists.newLinkedList();
        Map<Integer, List<House>> houseMap = Maps.newHashMap();
        Map<Integer, List<CarLot>> carLotMap = Maps.newHashMap();
        Map<Integer, List<StorageRoom>> storageRoomMap = Maps.newHashMap();
        if (CollectionUtils.isNotEmpty(pageBean.getDatas())) {
            List<Integer> contractIdList = Lists.newArrayList();
            for (Contract contract : pageBean.getDatas()) {
                contractIdList.add(contract.getId());
            }
            houseMap = this.houseService.getHouseMapByContractIdList(contractIdList);
            carLotMap = this.carLotService.getCarLotMapByContractIdList(contractIdList);
            storageRoomMap = this.storageRoomService.getStorageRoomMapByContractIdList(contractIdList);
        }

        if (CollectionUtils.isNotEmpty(pageBean.getDatas())) {
            Map map = null;
            String strInfo;
            String houseStr;
            String carLotStr;
            String storageRoomStr;
            String syAreaStr;
            for (Contract contract : pageBean.getDatas()) {
                map = null;
                houseStr = "";
                carLotStr = "";
                storageRoomStr = "";
                syAreaStr = "";
                map = Maps.newHashMap();
                map.put("printTableName", StringUtils.getNotNull(contract.getZsProject().getPrintTableName()));
                map.put("name", StringUtils.getNotNull(contract.getName()));
                map.put("chooseHouseNum", StringUtils.getNotNull(contract.getChooseHouseNum()));
                BigDecimal syArea = new BigDecimal("0");
                if (contract.getIsJiSuan() == 2) {
                    syArea = this.contractService.getSyAreaByAzContractId(contract.getId());
                }
                if (CollectionUtils.isNotEmpty(houseMap.get(contract.getId()))) {
                    for (House house : houseMap.get(contract.getId())) {
                        houseStr += house.getAzProject().getMemo() + house.getHouseNumStr() + ",";
                    }
                }
                if (CollectionUtils.isNotEmpty(carLotMap.get(contract.getId()))) {
                    for (CarLot carLot : carLotMap.get(contract.getId())) {
                        carLotStr += carLot.getAzProject().getMemo() + carLot.getHouseNumStr() + ",";
                    }
                }
                if (CollectionUtils.isNotEmpty(storageRoomMap.get(contract.getId()))) {
                    for (StorageRoom storageRoom : storageRoomMap.get(contract.getId())) {
                        storageRoomStr += storageRoom.getAzProject().getMemo() + storageRoom.getHouseNumStr() + ",";
                    }
                }
                map.put("strInfo", houseStr + carLotStr + storageRoomStr);
                map.put("houseStrInfo", houseStr);
                map.put("carLotStrInfo", carLotStr);
                map.put("storageRoomStrInfo", storageRoomStr);
                map.put("chooseHouseDate", DateUtils.dateToStringFormat(contract.getChooseHouseDate(), "yyyy-MM-dd HH:mm"));
                dataLists.add(map);
            }
        }
        Map resultMap = Maps.newHashMap();
        resultMap.put("totalCount", pageBean.getTotalCount());
        resultMap.put("dataLists", dataLists);

        Date nowDate = new Date();
        if (DateUtils.stringToDateTimeCompare(nowDate).equals("上午")) {
            resultMap.put("timeStr", DateUtils.dateToStringDefault(nowDate) + "上午已选房情况");
        } else if (DateUtils.stringToDateTimeCompare(nowDate).equals("下午")) {
            resultMap.put("timeStr", DateUtils.dateToStringDefault(nowDate) + "下午已选房情况");
        }
        return resultMap;
    }

    /**
     * 房源饼图、柱状图统计
     */
    @RequestMapping("houseShowPic")
    public void houseShowPic(ModelMap modelMap) {
    }

    /**
     * 饼图数据
     * 相应的征收项目下所分配的房源各楼统计
     *
     * @param request
     * @return
     */
    @RequestMapping("getBuildChooseHouseInfo")
    @ResponseBody
    public Map getBuildChooseHouseInfo(HttpServletRequest request) {
        String zsProjectIdStr = ParamUtils.getString(request, "zsProjectIdStr", "");
        String azProjectIdStr = ParamUtils.getString(request, "azProjectIdStr", "");
        Map<String, Map<String, Map<String, Integer>>> chooseHouseCountMap = this.houseService.getChooseHouseCountMap(zsProjectIdStr, azProjectIdStr);
        Map<String, AzProject> azProjectMap = this.azProjectService.getAzProjectMap();
        StringBuffer build = new StringBuffer("[");//楼号
        StringBuffer chooseCount = new StringBuffer("[");//已选
        StringBuffer noChooseCount = new StringBuffer("[");//未选
        StringBuffer pie = new StringBuffer("[");//饼图已选、未选
        StringBuffer chooseHouseInfo = new StringBuffer("[");//文字显示内容
        BigDecimal qifaArea, syqifangArea;

        if (CollectionUtils.isNotEmpty(chooseHouseCountMap)) {
            Map<String, Map<String, Integer>> itemMap = null;
            Map<String, Integer> itemItemMap = null;
            AzProject azProject = null;
            int houseTotalCount = 0, smallHouseTotalCount = 0, fsHouseTotalCount = 0,
                    normalHouseTotalCount = 0, noSmallHouseTotalCount = 0, noNormalHouseTotalCount = 0,
                    noFsHouseTotalCount = 0, total_choose = 0, total_noChoose = 0, total_chooseCur = 0,
                    bigHouseTotalCount = 0, total_big_choose = 0, total_big_noChoose = 0,
                    noBigHouseTotalCount = 0, total_noBig_choose = 0, total_noBig_noChoose = 0;
            for (String azProjectId : chooseHouseCountMap.keySet()) {
                azProject = null;
                itemMap = null;
                azProject = azProjectMap.get(azProjectId);
                itemMap = chooseHouseCountMap.get(azProjectId);
                if (CollectionUtils.isNotEmpty(itemMap)) {
                    for (String key : itemMap.keySet()) {
                        build.append("'" + key + "幢'").append(",");
                        itemItemMap = null;
                        itemItemMap = itemMap.get(key);

                        //总数量
                        int houseCount = Integer.valueOf(itemItemMap.get("houseCount"));
                        houseTotalCount = IntegerUtils.getSum(houseTotalCount, houseCount);
                        //剩余数量
                        int noChoose = Integer.valueOf(itemItemMap.get("noChooseCount"));
                        total_noChoose = IntegerUtils.getSum(total_noChoose, noChoose);
                        //今日选房数量
                        int choose_cur = Integer.valueOf(itemItemMap.get("chooseCountCur"));
                        total_chooseCur = IntegerUtils.getSum(total_chooseCur, choose_cur);
                        //累计已选数量
                        int choose = Integer.valueOf(itemItemMap.get("chooseCount"));
                        total_choose = IntegerUtils.getSum(total_choose, choose);
                        //小户型数量
                        int smallHouseCount = Integer.valueOf(itemItemMap.get("smallHouseCount"));
                        smallHouseTotalCount = IntegerUtils.getSum(smallHouseTotalCount, smallHouseCount);
                        //小户型剩余数量
                        int noSmallHouseCount = Integer.valueOf(itemItemMap.get("noSmallHouseCount"));
                        noSmallHouseTotalCount = IntegerUtils.getSum(noSmallHouseTotalCount, noSmallHouseCount);
                        //复式数量
                        int fsHouseCount = Integer.valueOf(itemItemMap.get("fsHouseCount"));
                        fsHouseTotalCount = IntegerUtils.getSum(fsHouseTotalCount, fsHouseCount);
                        //复式型剩余数量
                        int noFsHouseCount = Integer.valueOf(itemItemMap.get("noFsHouseCount"));
                        noFsHouseTotalCount = IntegerUtils.getSum(noFsHouseTotalCount, noFsHouseCount);
                        //普通型数量
                        int normalHouseCount = Integer.valueOf(itemItemMap.get("normalHouseCount"));
                        normalHouseTotalCount = IntegerUtils.getSum(normalHouseTotalCount, normalHouseCount);
                        //普通型剩余数量
                        int noNormalHouseCount = Integer.valueOf(itemItemMap.get("noNormalHouseCount"));
                        noNormalHouseTotalCount = IntegerUtils.getSum(noNormalHouseTotalCount, noNormalHouseCount);
                        //大户型总数量（复式、五房）
                        int bigHouseCount = Integer.valueOf(itemItemMap.get("bigHouseCount"));
                        bigHouseTotalCount = IntegerUtils.getSum(bigHouseTotalCount, bigHouseCount);
                        //大户型剩余总数量（复式、五房）
                        int bigHouseNoChooseCount = Integer.valueOf(itemItemMap.get("bigHouseNoChooseCount"));
                        total_big_noChoose = IntegerUtils.getSum(total_big_noChoose, bigHouseNoChooseCount);
                        //非大户型总数量（二房、三房、四房）
                        int noBigHouseCount = Integer.valueOf(itemItemMap.get("noBigHouseCount"));
                        noBigHouseTotalCount = IntegerUtils.getSum(noBigHouseTotalCount, noBigHouseCount);
                        //非大户型剩余数量（二房、三房、四房）
                        int noBigHouseNoChosoeCount = Integer.valueOf(itemItemMap.get("noBigHouseNoChosoeCount"));
                        total_noBig_noChoose = IntegerUtils.getSum(total_noBig_noChoose, noBigHouseNoChosoeCount);

                        chooseCount.append(choose).append(",");//已签约
                        noChooseCount.append(noChoose).append(",");//未签约
                    }
                }
            }
            build.deleteCharAt(build.lastIndexOf(","));
            chooseCount.deleteCharAt(chooseCount.lastIndexOf(","));
            noChooseCount.deleteCharAt(noChooseCount.lastIndexOf(","));
            pie.append(total_choose).append(",").append(total_noChoose);
            chooseHouseInfo.append(houseTotalCount).append(",").append(total_noChoose).append(",");
            chooseHouseInfo.append(total_chooseCur).append(",").append(total_choose).append(",");
            chooseHouseInfo.append(smallHouseTotalCount).append(",").append(noSmallHouseTotalCount).append(",");
            chooseHouseInfo.append(normalHouseTotalCount).append(",").append(noNormalHouseTotalCount).append(",");
            chooseHouseInfo.append(fsHouseTotalCount).append(",").append(noFsHouseTotalCount).append(",");
            chooseHouseInfo.append(bigHouseTotalCount).append(",").append(total_big_noChoose).append(",");
            chooseHouseInfo.append(noBigHouseTotalCount).append(",").append(total_noBig_noChoose);
        }
        build.append("]");
        chooseCount.append("]");
        noChooseCount.append("]");
        pie.append("]");
        chooseHouseInfo.append("]");

        Map map = Maps.newHashMap();
        map.put("build", JSON.parse(build.toString()));
        map.put("chooseCount", JSON.parse(chooseCount.toString()));
        map.put("noChooseCount", JSON.parse(noChooseCount.toString()));
        map.put("pie", JSON.parse(pie.toString()));
        map.put("chooseHouseInfo", JSON.parse(chooseHouseInfo.toString()));
        Date nowDate = new Date();
        if (DateUtils.stringToDateTimeCompare(nowDate).equals("上午")) {
            map.put("timeStr", DateUtils.dateToStringDefault(nowDate) + "上午已选房情况");
        } else if (DateUtils.stringToDateTimeCompare(nowDate).equals("下午")) {
            map.put("timeStr", DateUtils.dateToStringDefault(nowDate) + "下午已选房情况");
        }
        return map;
    }
    /**
     * 相应的征收项目下所分配的房源各楼统计
     *
     * @param request
     * @return
     */
    @RequestMapping("getBuildChooseHouseInfForCy")
    @ResponseBody
    public Map getBuildChooseHouseInfForCy(HttpServletRequest request) {
        String zsProjectIdStr = ParamUtils.getString(request, "zsProjectIdStr", "");
        String azProjectIdStr = ParamUtils.getString(request, "azProjectIdStr", "");
        String houseStyle = ParamUtils.getString(request, "houseStyle", "");
        String memo = ParamUtils.getString(request, "memo", "");
        Map<String, Map<String, Map<String, Integer>>> chooseHouseCountMap = this.houseService.getChooseHouseCountMapForXy(zsProjectIdStr, azProjectIdStr, houseStyle,memo);
        Map<String, AzProject> azProjectMap = this.azProjectService.getAzProjectMap();
        StringBuffer build = new StringBuffer("[");//楼号
        StringBuffer chooseCount = new StringBuffer("[");//已选
        StringBuffer noChooseCount = new StringBuffer("[");//未选
        StringBuffer pie = new StringBuffer("[");//饼图已选、未选
        StringBuffer chooseHouseInfo = new StringBuffer("[");//文字显示内容
        BigDecimal qifaArea, syqifangArea;

        if (CollectionUtils.isNotEmpty(chooseHouseCountMap)) {
            Map<String, Map<String, Integer>> itemMap = null;
            Map<String, Integer> itemItemMap = null;
            AzProject azProject = null;
            int houseTotalCount = 0, smallHouseTotalCount = 0, fsHouseTotalCount = 0,
                    normalHouseTotalCount = 0, noSmallHouseTotalCount = 0, noNormalHouseTotalCount = 0,
                    noFsHouseTotalCount = 0, total_choose = 0, total_noChoose = 0, total_chooseCur = 0,
                    bigHouseTotalCount = 0, total_big_choose = 0, total_big_noChoose = 0,
                    noBigHouseTotalCount = 0, total_noBig_choose = 0, total_noBig_noChoose = 0;
            for (String azProjectId : chooseHouseCountMap.keySet()) {
                azProject = null;
                itemMap = null;
                azProject = azProjectMap.get(azProjectId);
                itemMap = chooseHouseCountMap.get(azProjectId);
                if (CollectionUtils.isNotEmpty(itemMap)) {
                    for (String key : itemMap.keySet()) {
                        build.append("'" + key + "幢'").append(",");
                        itemItemMap = null;
                        itemItemMap = itemMap.get(key);

                        //总数量
                        int houseCount = Integer.valueOf(itemItemMap.get("houseCount"));
                        houseTotalCount = IntegerUtils.getSum(houseTotalCount, houseCount);
                        //剩余数量
                        int noChoose = Integer.valueOf(itemItemMap.get("noChooseCount"));
                        total_noChoose = IntegerUtils.getSum(total_noChoose, noChoose);
                        //今日选房数量
                        int choose_cur = Integer.valueOf(itemItemMap.get("chooseCountCur"));
                        total_chooseCur = IntegerUtils.getSum(total_chooseCur, choose_cur);
                        //累计已选数量
                        int choose = Integer.valueOf(itemItemMap.get("chooseCount"));
                        total_choose = IntegerUtils.getSum(total_choose, choose);
                        //小户型数量
                        int smallHouseCount = Integer.valueOf(itemItemMap.get("smallHouseCount"));
                        smallHouseTotalCount = IntegerUtils.getSum(smallHouseTotalCount, smallHouseCount);
                        //小户型剩余数量
                        int noSmallHouseCount = Integer.valueOf(itemItemMap.get("noSmallHouseCount"));
                        noSmallHouseTotalCount = IntegerUtils.getSum(noSmallHouseTotalCount, noSmallHouseCount);
                        //复式数量
                        int fsHouseCount = Integer.valueOf(itemItemMap.get("fsHouseCount"));
                        fsHouseTotalCount = IntegerUtils.getSum(fsHouseTotalCount, fsHouseCount);
                        //复式型剩余数量
                        int noFsHouseCount = Integer.valueOf(itemItemMap.get("noFsHouseCount"));
                        noFsHouseTotalCount = IntegerUtils.getSum(noFsHouseTotalCount, noFsHouseCount);
                        //普通型数量
                        int normalHouseCount = Integer.valueOf(itemItemMap.get("normalHouseCount"));
                        normalHouseTotalCount = IntegerUtils.getSum(normalHouseTotalCount, normalHouseCount);
                        //普通型剩余数量
                        int noNormalHouseCount = Integer.valueOf(itemItemMap.get("noNormalHouseCount"));
                        noNormalHouseTotalCount = IntegerUtils.getSum(noNormalHouseTotalCount, noNormalHouseCount);
                        //大户型总数量（复式、五房）
                        int bigHouseCount = Integer.valueOf(itemItemMap.get("bigHouseCount"));
                        bigHouseTotalCount = IntegerUtils.getSum(bigHouseTotalCount, bigHouseCount);
                        //大户型剩余总数量（复式、五房）
                        int bigHouseNoChooseCount = Integer.valueOf(itemItemMap.get("bigHouseNoChooseCount"));
                        total_big_noChoose = IntegerUtils.getSum(total_big_noChoose, bigHouseNoChooseCount);
                        //非大户型总数量（二房、三房、四房）
                        int noBigHouseCount = Integer.valueOf(itemItemMap.get("noBigHouseCount"));
                        noBigHouseTotalCount = IntegerUtils.getSum(noBigHouseTotalCount, noBigHouseCount);
                        //非大户型剩余数量（二房、三房、四房）
                        int noBigHouseNoChosoeCount = Integer.valueOf(itemItemMap.get("noBigHouseNoChosoeCount"));
                        total_noBig_noChoose = IntegerUtils.getSum(total_noBig_noChoose, noBigHouseNoChosoeCount);

                        chooseCount.append(choose).append(",");//已签约
                        noChooseCount.append(noChoose).append(",");//未签约
                    }
                }
            }
            build.deleteCharAt(build.lastIndexOf(","));
            chooseCount.deleteCharAt(chooseCount.lastIndexOf(","));
            noChooseCount.deleteCharAt(noChooseCount.lastIndexOf(","));
            pie.append(total_choose).append(",").append(total_noChoose);
            chooseHouseInfo.append(houseTotalCount).append(",").append(total_noChoose).append(",");
            chooseHouseInfo.append(total_chooseCur).append(",").append(total_choose).append(",");
            chooseHouseInfo.append(smallHouseTotalCount).append(",").append(noSmallHouseTotalCount).append(",");
            chooseHouseInfo.append(normalHouseTotalCount).append(",").append(noNormalHouseTotalCount).append(",");
            chooseHouseInfo.append(fsHouseTotalCount).append(",").append(noFsHouseTotalCount).append(",");
            chooseHouseInfo.append(bigHouseTotalCount).append(",").append(total_big_noChoose).append(",");
            chooseHouseInfo.append(noBigHouseTotalCount).append(",").append(total_noBig_noChoose);
        }
        build.append("]");
        chooseCount.append("]");
        noChooseCount.append("]");
        pie.append("]");
        chooseHouseInfo.append("]");

        Map map = Maps.newHashMap();
        map.put("build", JSON.parse(build.toString()));
        map.put("chooseCount", JSON.parse(chooseCount.toString()));
        map.put("noChooseCount", JSON.parse(noChooseCount.toString()));
        map.put("pie", JSON.parse(pie.toString()));
        map.put("chooseHouseInfo", JSON.parse(chooseHouseInfo.toString()));
        Date nowDate = new Date();
        if (DateUtils.stringToDateTimeCompare(nowDate).equals("上午")) {
            map.put("timeStr", DateUtils.dateToStringDefault(nowDate) + "上午已选房情况");
        } else if (DateUtils.stringToDateTimeCompare(nowDate).equals("下午")) {
            map.put("timeStr", DateUtils.dateToStringDefault(nowDate) + "下午已选房情况");
        }
        return map;
    }


    /**
     * 房源表格统计主界面
     */
    @RequestMapping("houseShowForCy")
    public void houseShowForCy(HttpServletRequest request, ModelMap modelMap) {

    }
    /**
     * 房源表格统计获取房源数据
     *
     * @param request
     * @return
     */
    @RequestMapping("houseShowHoldForCy")
    public void houseShowHoldForCy(HttpServletRequest request, ModelMap modelMap) {

        String zsProjectIdStr = ParamUtils.getString(request, "zsProjectIdStr", "");
        String azProjectIdStr = ParamUtils.getString(request, "azProjectIdStr", "");
        Map<String, Map<String, Map<String, Map>>> houseHoldDataMap = this.houseService.getHouseHoldMap(zsProjectIdStr, azProjectIdStr);
        Map<String, String> houseHoldMap = this.dataDictService.getMapByParentNameForValue_Name("房屋户型");
        Map<String, AzProject> azProjectMap = this.azProjectService.getAzProjectMap();
        modelMap.addAttribute("houseHoldDataMap", houseHoldDataMap);
        modelMap.addAttribute("houseHoldMap", houseHoldMap);
        modelMap.addAttribute("azProjectMap", azProjectMap);

    }
}
